<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        .container {
            border: 1px solid red;
            width: 800px;
            height: 800px;
        }
        .box1,
        .box2 {
            width: 100px;
            height: 100px;
            background: green;
        }

        /* 设置盒子外边距 */
        .box1 {
            /* 单值法 */
            /* margin: 50px; */
            /* 二值法 */
            /* margin: 50px 10px; */
            /* 三值法 */
            /* margin: 50px 20px 10px; */
            /* 四值法 */
            /* margin: 10px 20px 50px 40px; */
            /* 单独设置 */
            margin-top: 10px;
            margin-left: 40px;
            margin-right: 30px;
            margin-bottom: 50px;

        }
    </style>
</head>
<body>
    <div class="container">
        <div class="box1"></div>
        <div class="box2"></div>
    </div>
</body>
</html>